import random

from auther.models import AdminUser
from utils.token import Token
from xftinterfaces.functions.xftclass import XftInterface
from utils.ehr import EhrConnect
from salarys.models import *
import time


def check_stfseq(period_name):
    '''
    给所有当月有薪资的人检查是否都有个税员工序号，没有则查询并写入ehr相应字段。
    :param period_name:
    :return:
    '''
    # 查询没有个税员工序号的人
    ehr_connect = EhrConnect()
    payroll_list = ehr_connect.select("""SELECT 
                b.id,b.IdentityNumber
                FROM
                    T_HR_Payroll AS a
                    INNER JOIN T_HR_Employee AS b ON a.EmpID = b.id
                    INNER JOIN T_HR_Period AS c ON a.MonthID = c.id 
                WHERE
                    b.stfseq IS NULL 
                    AND 
                    c.PeriodName = '%s' 
    """ % period_name)
    print(payroll_list)
    if payroll_list:
        xft = XftInterface()
        for emp in payroll_list:
            xft.empInfoBodyStr = {
                "TXSTFQRYX": [
                    {
                        "CERTYP": "A",
                        "CERNBR": emp['IdentityNumber'],
                    }
                ]
            }
            emp_info = xft.employeeinfosearch()
            print(emp_info)
            if emp_info:
                ehr_connect.update("update T_HR_Employee set stfseq = '%s', regseq= '%s' where id = %s" % (emp_info['TXSTFQRYZ'][0]['STFSEQ'], emp_info['TXSTFQRYZ'][0]['REGSEQ'], emp['id']))
            time.sleep(3)


def check_all_stfseq(token):
    """
    获取全部的人员
    :return:
    """
    return_data = {'code': 200, "msg": ""}
    token_class = Token()
    token_class.token = token
    user_id = token_class.check_token()
    if user_id:
        xft_account_info = AdminUser.objects.filter(id=user_id).values(
            'xft_account__xft_private_key',
            'xft_account__xft_public_key',
            'xft_account__xft_cscappuid',
            'xft_account__xft_cscprjcod',
            'xft_account__xft_cscusrnbr',
            'xft_account__xft_cscusruid',
            'xft_account__xft_appid',
            'xft_account__xft_tax_office_code',
            'xft_account__xft_tax_office_password'
        )
        if xft_account_info.exists():
            ehr_connect = EhrConnect()
            xft = XftInterface()
            xft.privateKey = xft_account_info[0]['xft_account__xft_private_key']
            xft.publicKey = xft_account_info[0]['xft_account__xft_public_key']
            xft.CSCAPPUID = xft_account_info[0]['xft_account__xft_cscappuid']
            xft.CSCPRJCOD = xft_account_info[0]['xft_account__xft_cscprjcod']
            xft.CSCUSRNBR = xft_account_info[0]['xft_account__xft_cscusrnbr']
            xft.CSCUSRUID = xft_account_info[0]['xft_account__xft_cscusruid']
            xft.appid = xft_account_info[0]['xft_account__xft_appid']
            xft.empInfoBodyStr = {}
            emp_info = xft.employeeinfosearch()
            if emp_info:
                return_data["msg"] = "同步人员信息成功"
                temp_value = ''
                total = 0
                for data in emp_info['TXSTFQRYZ']:
                    if total < 900:
                        total = total + 1
                        temp_value = temp_value + "('" + data['CERNBR'] + "','" + data['STFSEQ'] + "','" + data['REGSEQ'] + "'),"
                    else:
                        ehr_connect.update("INSERT into xft_temp(IdentityNumber,stfseq,regseq)VALUES %s" % temp_value[:-1])
                        total = 0
                        temp_value = ''
                ehr_connect.update("INSERT into xft_temp(IdentityNumber,stfseq,regseq)VALUES %s" % temp_value[:-1])
                ehr_connect.update("update T_HR_Employee set stfseq = xft_temp.stfseq,regseq = xft_temp.regseq from xft_temp where T_HR_Employee.IdentityNumber = xft_temp.IdentityNumber and T_HR_Employee.EmployeeStatusID = '1'")
                ehr_connect.update("delete FROM xft_temp")
            else:
                return_data["msg"] = "薪福通报错，请联系管理员"
                return_data["code"] = 500
        else:
            return_data["msg"] = "账户未绑定薪福通信息"
            return_data["code"] = 403
    else:
        return_data["msg"] = "token已过期"
        return_data["code"] = 401
    return return_data


def calc_salary(token, period_name):
    '''
    获取当月个税员工序号不为空的人的薪资数据，调用薪福通个税创建接口
    :param period_name:
    :return:
    '''
    return_data = {'code': 200, "msg": ""}
    token_class = Token()
    token_class.token = token
    user_id = token_class.check_token()
    if user_id:
        xft_account_info = AdminUser.objects.filter(id=user_id).values(
            'xft_account__xft_private_key',
            'xft_account__xft_public_key',
            'xft_account__xft_cscappuid',
            'xft_account__xft_cscprjcod',
            'xft_account__xft_cscusrnbr',
            'xft_account__xft_cscusruid',
            'xft_account__xft_appid',
            'xft_account__xft_tax_office_code',
            'xft_account__xft_tax_office_password'
        )
        if xft_account_info.exists():
            ehr_connect = EhrConnect()
            xft = XftInterface()
            xft.privateKey = xft_account_info[0]['xft_account__xft_private_key']
            xft.publicKey = xft_account_info[0]['xft_account__xft_public_key']
            xft.CSCAPPUID = xft_account_info[0]['xft_account__xft_cscappuid']
            xft.CSCPRJCOD = xft_account_info[0]['xft_account__xft_cscprjcod']
            xft.CSCUSRNBR = xft_account_info[0]['xft_account__xft_cscusrnbr']
            xft.CSCUSRUID = xft_account_info[0]['xft_account__xft_cscusruid']
            xft.appid = xft_account_info[0]['xft_account__xft_appid']
            # 查找数据库是否有相同的周期的BUSNBR，有就拿来用，没有就新建，区分新批次和重新计算
            tax_calc_create_model = TaxCalcCreateReturn.objects.filter(create_return_period=period_name).values('create_return_busnbr')
            if tax_calc_create_model:
                BUSNBR = tax_calc_create_model[0]['create_return_busnbr']
            else:
                BUSNBR = period_name[:4] + '-' + period_name[5:7] + str(random.randint(1, 99))
            bodyStr = {
                "TXCRTBATX": [
                    {
                        "BUSNBR": BUSNBR,
                        "BATNAM": "批次名称",
                        "DURTAX": period_name[:4] + period_name[5:7],
                        "INCTYP": "1",
                        "INCITE": "01",
                        "USLSPE": "N",
                        "CALIMD": "Y",
                        "CALTYP": "0"
                    }
                ],
                "TXREGPWDX": [
                    {
                        "REGSEQ": xft_account_info[0]['xft_account__xft_tax_office_code'],
                        "PWDTYP": "0",
                        "DCLPWD": xft_account_info[0]['xft_account__xft_tax_office_password'],
                    }
                ],
                "TXSTFSALX": []
            }

            # 先判断是否有重复的
            payroll_list = ehr_connect.select("""
                            SELECT
                                EmpID,
                                MonthID,
                                COUNT ( EmpID ) 
                            FROM
                                T_HR_Payroll
                                INNER JOIN T_HR_Period AS b ON T_HR_Payroll.MonthID = b.id 
                            WHERE
                                b.PeriodName = '%s' 
                            GROUP BY
                                T_HR_Payroll.EmpID,
                                T_HR_Payroll.MonthID 
                            HAVING
                                COUNT ( T_HR_Payroll.EmpID ) > 1
                                    """ % period_name)
            if len(payroll_list) > 0:
                return "当月有EHR薪资数据重复，请联系管理员处理"
            else:
                payroll_list = ehr_connect.select("""SELECT 
                            b.IdentityNumber,
                            b.stfseq,
                            b.regseq,
                            a._yfhj,
                            a._gryangl,
                            a._gryil,
                            a._grsy,
                            a._gjjgr
                            FROM
                                T_HR_Payroll AS a
                                INNER JOIN T_HR_Employee AS b ON a.EmpID = b.id
                                INNER JOIN T_HR_Period AS c ON a.MonthID = c.id 
                            WHERE
                                b.stfseq IS not NULL 
                                and b.regseq = '%s'
                                AND 
                                c.PeriodName = '%s' 
                """ % (xft_account_info[0]['xft_account__xft_tax_office_code'], period_name))
                if payroll_list:
                    return_data["msg"] = "计算个税成功"
                    return_data["code"] = 200
                    for pay in payroll_list:
                        bodyStr["TXSTFSALX"].append({
                            "STFSEQ": pay["stfseq"],
                            "REGSEQ": pay["regseq"],
                            "REVCOU": float(pay["_yfhj"]),
                            "JBYLBX": float(pay["_gryangl"]) if pay["_gryangl"] is not None else 0,
                            "JBYIBX": float(pay["_gryil"]) if pay["_gryil"] is not None else 0,
                            "SYVXYE": float(pay["_grsy"]) if pay["_grsy"] is not None else 0,
                            "ZFGJJY": float(pay["_gjjgr"]) if pay["_gjjgr"] is not None else 0,
                        })
                xft.taxCalcCreateObj = bodyStr
                xft_return = xft.taxcalccreate()
                # 税局错误信息写入表中
                if "TXDUTREGY" in xft_return.keys():
                    for fail in xft_return['TXDUTREGY']:
                        TaxCalcCreateFail.objects.create(
                            create_fail_period=period_name,
                            create_fail_depnbr=fail['DEPNBR'] if 'DEPNBR' in fail.keys() else None,
                            create_fail_errtyp=fail['ERRTYP'] if 'ERRTYP' in fail.keys() else None,
                            create_fail_infdtl=fail['INFDTL'] if 'INFDTL' in fail.keys() else None,
                            create_fail_regseq=fail['REGSEQ'] if 'REGSEQ' in fail.keys() else None,
                            create_fail_depnam=fail['DEPNAM'] if 'DEPNAM' in fail.keys() else None,
                            create_fail_nicnam=fail['NICNAM'] if 'NICNAM' in fail.keys() else None,
                            create_fail_prjnam=fail['PRJNAM'] if 'PRJNAM' in fail.keys() else None,
                            create_fail_taxorg=fail['TAXORG'] if 'TAXORG' in fail.keys() else None,
                            create_fail_wgznmr=fail['WGZNBR'] if 'WGZNBR' in fail.keys() else None,
                            create_fail_taxsub=fail['TAXSUB'] if 'TAXSUB' in fail.keys() else None,
                        )
                # 员工薪资错误信息写入表中
                if "TXSTFSALY" in xft_return.keys():
                    for fail in xft_return['TXSTFSALY']:
                        TaxCalcCreateFailEmp.objects.create(
                            create_fail_emp_period=period_name,
                            create_fail_emp_stfseq=fail['STFSEQ'] if 'STFSEQ' in fail.keys() else None,
                            create_fail_emp_apiseq=fail['APISEQ'] if 'APISEQ' in fail.keys() else None,
                            create_fail_emp_regseq=fail['REGSEQ'] if 'REGSEQ' in fail.keys() else None,
                            create_fail_emp_busnbr=fail['BUSNBR'] if 'BUSNBR' in fail.keys() else None,
                            create_fail_emp_errtyp=fail['ERRTYP'] if 'ERRTYP' in fail.keys() else None,
                            create_fail_emp_errcod=fail['ERRCOD'] if 'ERRCOD' in fail.keys() else None,
                            create_fail_emp_errmsg=fail['ERRMSG'] if 'ERRMSG' in fail.keys() else None,
                            create_fail_emp_stfnam=fail['STFNAM'] if 'STFNAM' in fail.keys() else None,
                            create_fail_emp_certyp=fail['CERTYP'] if 'CERTYP' in fail.keys() else None,
                            create_fail_emp_cernbr=fail['CERNBR'] if 'CERNBR' in fail.keys() else None,
                            create_fail_emp_lstdec=fail['LSTDEC'] if 'LSTDEC' in fail.keys() else None,
                        )
                # 系统薪资错误信息写入表中
                if "SYCOMRETZ" in xft_return.keys():
                    for fail in xft_return['SYCOMRETZ']:
                        TaxCalcCreateFailSys.objects.create(
                            create_fail_sys_period=period_name,
                            create_fail_sys_busnbr=BUSNBR,
                            create_fail_sys_errmsg=fail['ERRMSG'] if 'ERRMSG' in fail.keys() else None,
                            create_fail_sys_errflg=fail['ERRFLG'] if 'ERRFLG' in fail.keys() else None,
                            create_fail_sys_errcod=fail['ERRCOD'] if 'ERRCOD' in fail.keys() else None,
                            create_fail_sys_errpam=fail['ERRPAM'] if 'ERRPAM' in fail.keys() else None,
                            create_fail_sys_errdtl=fail['ERRDTL'] if 'ERRDTL' in fail.keys() else None,
                        )
                # 成功信息写入
                if "TXBATDTLY" in xft_return.keys():
                    for backData in xft_return['TXBATDTLY']:
                        TaxCalcCreateReturn.objects.update_or_create(
                            defaults={
                                'create_return_period': period_name,
                                'create_return_body': bodyStr,
                                'create_return_grpseq': backData['GRPSEQ'] if 'GRPSEQ' in backData.keys() else None,
                                'create_return_busnbr': backData['BUSNBR'] if 'BUSNBR' in backData.keys() else None,
                                'create_return_batpid': backData['BATPID'] if 'BATPID' in backData.keys() else None,
                                'create_return_batnam': backData['BATNAM'] if 'BATNAM' in backData.keys() else None,
                                'create_return_catxst': backData['CATXST'] if 'CATXST' in backData.keys() else None,
                            },
                            create_return_period=period_name,
                            create_return_batpid=backData['BATPID'] if 'BATPID' in backData.keys() else None,
                        )
    return return_data


def search_salary(token, period_name):
    return_data = {'code': 200, "msg": ""}
    token_class = Token()
    token_class.token = token
    user_id = token_class.check_token()
    if user_id:
        xft_account_info = AdminUser.objects.filter(id=user_id).values(
            'xft_account__xft_private_key',
            'xft_account__xft_public_key',
            'xft_account__xft_cscappuid',
            'xft_account__xft_cscprjcod',
            'xft_account__xft_cscusrnbr',
            'xft_account__xft_cscusruid',
            'xft_account__xft_appid',
            'xft_account__xft_tax_office_code',
            'xft_account__xft_tax_office_password'
        )
        if xft_account_info.exists():
            xft = XftInterface()
            xft.privateKey = xft_account_info[0]['xft_account__xft_private_key']
            xft.publicKey = xft_account_info[0]['xft_account__xft_public_key']
            xft.CSCAPPUID = xft_account_info[0]['xft_account__xft_cscappuid']
            xft.CSCPRJCOD = xft_account_info[0]['xft_account__xft_cscprjcod']
            xft.CSCUSRNBR = xft_account_info[0]['xft_account__xft_cscusrnbr']
            xft.CSCUSRUID = xft_account_info[0]['xft_account__xft_cscusruid']
            xft.appid = xft_account_info[0]['xft_account__xft_appid']
            bodyStr = {
                "TXCALINFX": [
                    {
                        "DUTXST": period_name[:4] + period_name[5:7],
                        "DUTXEN": period_name[:4] + period_name[5:7],
                        "INCTYP": "1"
                    }
                ],
                "TXREGSEQX": [
                    {
                        "REGSEQ": xft_account_info[0]['xft_account__xft_tax_office_code']
                    }
                ],
                "SYPAGINFY": [
                    {
                        "PGENUM": "10000",
                        "PAGNBR": "1"
                    }
                ]
            }
            xft.taxsearchObj = bodyStr
            xft_return = xft.taxsearch()
            # 成功信息写入
            if "TXDECREFY" in xft_return.keys():
                return_data["msg"] = "获取数据成功"
                return_data["code"] = 200
                for backData in xft_return['TXDECREFY']:
                    TaxSearchResult.objects.update_or_create(
                        defaults={
                            'search_result_period': period_name,
                            'search_result_stfnam': backData['STFNAM'] if 'STFNAM' in backData.keys() else None,
                            'search_result_natnlt': backData['NATNLT'] if 'NATNLT' in backData.keys() else None,
                            'search_result_certyp': backData['CERTYP'] if 'CERTYP' in backData.keys() else None,
                            'search_result_cernbr': backData['CERNBR'] if 'CERNBR' in backData.keys() else None,
                            'search_result_orgseq': backData['ORGSEQ'] if 'ORGSEQ' in backData.keys() else None,
                            'search_result_regseq': backData['REGSEQ'] if 'REGSEQ' in backData.keys() else None,
                            'search_result_durtax': backData['DURTAX'] if 'DURTAX' in backData.keys() else None,
                            'search_result_taxorg': backData['TAXORG'] if 'TAXORG' in backData.keys() else None,
                            'search_result_prjnam': backData['PRJNAM'] if 'PRJNAM' in backData.keys() else None,
                            'search_result_depnam': backData['DEPNAM'] if 'DEPNAM' in backData.keys() else None,
                            'search_result_depnbr': backData['DEPNBR'] if 'DEPNBR' in backData.keys() else None,
                            'search_result_inctyp': backData['INCTYP'] if 'INCTYP' in backData.keys() else None,
                            'search_result_isbmba': backData['ISBMBA'] if 'ISBMBA' in backData.keys() else None,
                            'search_result_nicnam': backData['NICNAM'] if 'NICNAM' in backData.keys() else None,
                            'search_result_incite': backData['INCITE'] if 'INCITE' in backData.keys() else None,
                            'search_result_groinc': backData['GROINC'] if 'GROINC' in backData.keys() else None,
                            'search_result_ybtsef': backData['YBTSEF'] if 'YBTSEF' in backData.keys() else None,
                            'search_result_jcfyfd': backData['JCFYFD'] if 'JCFYFD' in backData.keys() else None,
                            'search_result_crmssd': backData['CRMSSD'] if 'CRMSSD' in backData.keys() else None,
                            'search_result_jbylbx': backData['JBYLBX'] if 'JBYLBX' in backData.keys() else None,
                            'search_result_jbyibx': backData['JBYIBX'] if 'JBYIBX' in backData.keys() else None,
                            'search_result_syvxye': backData['SYVXYE'] if 'SYVXYE' in backData.keys() else None,
                            'search_result_zfgjjy': backData['ZFGJJY'] if 'ZFGJJY' in backData.keys() else None,
                            'search_result_annuty': backData['ANNUTY'] if 'ANNUTY' in backData.keys() else None,
                            'search_result_syjkbx': backData['SYJKBX'] if 'SYJKBX' in backData.keys() else None,
                            'search_result_syylbx': backData['SYYLBX'] if 'SYYLBX' in backData.keys() else None,
                            'search_result_qtkchj': backData['QTKCHJ'] if 'QTKCHJ' in backData.keys() else None,
                            'search_result_fudval': backData['FUDVAL'] if 'FUDVAL' in backData.keys() else None,
                            'search_result_othinf': backData['OTHINF'] if 'OTHINF' in backData.keys() else None,
                            'search_result_yykcsf': backData['YYKCSF'] if 'YYKCSF' in backData.keys() else None,
                            'search_result_zykcjk': backData['ZYKCJK'] if 'ZYKCJK' in backData.keys() else None,
                            'search_result_jmsezd': backData['JMSEZD'] if 'JMSEZD' in backData.keys() else None,
                            'search_result_ljykjn': backData['LJYKJN'] if 'LJYKJN' in backData.keys() else None,
                            'search_result_ljyjse': backData['LJYJSE'] if 'LJYJSE' in backData.keys() else None,
                            'search_result_ykjsef': backData['YKJSEF'] if 'YKJSEF' in backData.keys() else None,
                            'search_result_yjsefd': backData['YJSEFD'] if 'YJSEFD' in backData.keys() else None,
                            'search_result_ljsref': backData['LJSREF'] if 'LJSREF' in backData.keys() else None,
                            'search_result_ljjcfy': backData['LJJCFY'] if 'LJJCFY' in backData.keys() else None,
                            'search_result_ljzxkc': backData['LJZXKC'] if 'LJZXKC' in backData.keys() else None,
                            'search_result_ljyyef': backData['LJYYEF'] if 'LJYYEF' in backData.keys() else None,
                            'search_result_ljznjy': backData['LJZNJY'] if 'LJZNJY' in backData.keys() else None,
                            'search_result_ljsylr': backData['LJSYLR'] if 'LJSYLR' in backData.keys() else None,
                            'search_result_ljzflx': backData['LJZFLX'] if 'LJZFLX' in backData.keys() else None,
                            'search_result_ljzfzj': backData['LJZFZJ'] if 'LJZFZJ' in backData.keys() else None,
                            'search_result_ljjxjy': backData['LJJXJY'] if 'LJJXJY' in backData.keys() else None,
                            'search_result_lzxfjk': backData['LZXFJK'] if 'LZXFJK' in backData.keys() else None,
                            'search_result_ljqkce': backData['LJQKCE'] if 'LJQKCE' in backData.keys() else None,
                            'search_result_ljzykd': backData['LJZYKD'] if 'LJZYKD' in backData.keys() else None,
                            'search_result_ynssde': backData['YNSSDE'] if 'YNSSDE' in backData.keys() else None,
                            'search_result_sskcsf': backData['SSKCSF'] if 'SSKCSF' in backData.keys() else None,
                            'search_result_ynsefd': backData['YNSEFD'] if 'YNSEFD' in backData.keys() else None,
                            'search_result_taxrat': backData['TAXRAT'] if 'TAXRAT' in backData.keys() else None,
                            'search_result_remark': backData['REMARK'] if 'REMARK' in backData.keys() else None,
                            'search_result_ptsism': backData['PTSISM'] if 'PTSISM' in backData.keys() else None,
                            'search_result_sfctrt': backData['SFCTRT'] if 'SFCTRT' in backData.keys() else None,
                            'search_result_revcou': backData['REVCOU'] if 'REVCOU' in backData.keys() else None,
                            'search_result_orgcod': backData['ORGCOD'] if 'ORGCOD' in backData.keys() else None,
                            'search_result_whanam': backData['WHANAM'] if 'WHANAM' in backData.keys() else None,
                            'search_result_ybtses': backData['YBTSES'] if 'YBTSES' in backData.keys() else None,
                            'search_result_orgnam': backData['ORGNAM'] if 'ORGNAM' in backData.keys() else None,
                        },
                        search_result_period=period_name,
                        search_result_revcou=backData['REVCOU'] if 'REVCOU' in backData.keys() else None,
                        search_result_cernbr=backData['CERNBR'] if 'CERNBR' in backData.keys() else None,
                    )
    else:
        return_data["msg"] = "token已过期"
        return_data["code"] = 401
    print(return_data)
    return return_data


def set_tax_to_ehr(token, period_name):
    """
    根据周期获取当月ehr的薪资报表，遍历取出，查询存储的个税信息，写入ehr的表中
    :param period_name:
    :return:
    """
    return_data = {'code': 200, "msg": ""}
    token_class = Token()
    token_class.token = token
    user_id = token_class.check_token()
    if user_id:
        office_code = AdminUser.objects.filter(id=user_id).values('xft_account__xft_tax_office_code').first()
        ehr_connect = EhrConnect()
        payroll_list = ehr_connect.select("""SELECT 
                            b.IdentityNumber,
                            b.Code,
                            a._yfhj,
                            b.id as empid,
                            c.id as monthid
                            FROM
                                T_HR_Payroll AS a
                                INNER JOIN T_HR_Employee AS b ON a.EmpID = b.id
                                INNER JOIN T_HR_Period AS c ON a.MonthID = c.id 
                            WHERE
                                b.stfseq IS not NULL 
                                and b.EmployeeStatusID = '1'
                                AND 
                                c.PeriodName = '%s' 
                """ % period_name)
        if payroll_list:
            for pay in payroll_list:
                income_tax = TaxSearchResult.objects.filter(search_result_cernbr=pay['IdentityNumber'], search_result_groinc=str(pay['_yfhj']), search_result_period=period_name,search_result_regseq=office_code['xft_account__xft_tax_office_code']).values(
                    'search_result_ybtsef')
                if income_tax.exists():
                    set_to_ehr_return = ehr_connect.update("""IF NOT EXISTS ( SELECT * FROM Cust_gs WHERE empid = %s and monthid  = %s ) INSERT INTO Cust_gs ( empid, monthid, gs )
                                                                VALUES
                                                                    ( %s, %s, %s ) ELSE UPDATE Cust_gs 
                                                                    SET gs = %s 
                                                                WHERE
                                                                    empid = %s 
                                                                    AND monthid = %s
                                                                """ % (
                        int(pay['empid']), int(pay['monthid']), int(pay['empid']), int(pay['monthid']), float(income_tax[0]['search_result_ybtsef']), float(income_tax[0]['search_result_ybtsef']),
                        int(pay['empid']), int(pay['monthid'])))
        return {'code': 200, "msg": "同步成功"}
